import Vue from 'vue'
import Router from 'vue-router'
import Homepage from '@/view/homePage/Homepage.vue'
import Product from '@/view/product/Product'
import Infomation from '@/view/news/Infomation'
import Application from '@/view/application/Application'
import Company from '@/view/company/Company'
import Contact from '@/view//contact/Contact'
import Safety from '@/view/safety/Safety'
import NewsDetails from '@/view/news/NewsDetails'
import SecurityDetailsPage from '@/view/safety/SecurityDetailsPage'
import ProductDetails from '@/view/product/ProductDetails'
import ProductVideo from '@/view/video/ProductVideo'
import VideoPage from '@/view/video/VideoPage'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Homepage',
      component: Homepage,
    },
    {
      path: '/Product',
      name: 'Product',
      component: Product
    },
    {
      path: '/Infomation',
      name: 'Infomation',
      component: Infomation
    },
    {
      path: '/Application',
      name: 'Application',
      component: Application
    },
    {
      path: '/Company',
      name: 'Company',
      component: Company
    },
    {
      path: '/Contact',
      name: 'Contact',
      component: Contact
    },
    {
      path: '/Safety',
      name: 'Safety',
      component: Safety
    },
    {
      path: '/NewsDetails/:id',
      name: 'NewsDetails',
      component: NewsDetails
    },
    {
      path: '/ProductDetails/:id',
      name: 'ProductDetails',
      component: ProductDetails
    },
    {
      path: '/SecurityDetailsPage/:id',
      name: 'SecurityDetailsPage',
      component: SecurityDetailsPage
    },
    {
      path: '/ProductVideo',
      name: 'ProductVideo',
      component: ProductVideo
    },
    {
      path: '/VideoPage/:id',
      name: 'VideoPage',
      component: VideoPage
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
  // scrollBehavior (to, from, savedPosition) {
  //   if (to.hash) {
  //     return {
  //       selector: to.hash
  //     }
  //   }
  // }
})
